-
-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(WIP) PayPal subscribtions #274
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #274 +/- ##
==========================================
- Coverage 79.92% 78.58% -1.34%
==========================================
Files 28 28
Lines 1783 1868 +85
Branches 212 223 +11
==========================================
+ Hits 1425 1468 +43
- Misses 251 283 +32
- Partials 107 117 +10
Continue to review full report at Codecov.
|
for more information, see https://pre-commit.ci
Now I was at least able to override the plan price. |
I have re-implemented this in django-plans-paypal which uses subscription button from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the slowness in feedback here; every time I looked at this PR I couldn't quite figure out a few details... I've questions about it below:
@@ -36,6 +38,60 @@ def __setattr__(self, key, value): | |||
self._payment.extra_data = json.dumps(data) | |||
|
|||
|
|||
class BaseSubscription(models.Model): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, applications need to provide a subclass of this model, correct?
Can you add a brief docstring mentioning this?
def autocomplete_with_subscription(self, payment): | ||
""" | ||
Complete the payment with subscription | ||
Used by providers, that use server initiated subscription workflow | ||
|
||
Throws RedirectNeeded if there is problem with the payment that needs to be solved by user | ||
""" | ||
raise NotImplementedError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this method should do.
What does autocomplete
mean in this context?
def get_period(self) -> int: | ||
raise NotImplementedError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what this is supposed to return either.
class TimeUnit(enum.Enum): | ||
year = "year" | ||
month = "month" | ||
day = "day" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you're looking for https://github.com/jazzband/django-recurrence/?
This is partially working implementation of PayPal subscriptions. I was able to manage subscription creation, getting state and cancelling. This is based subscription support drafted in #217.
Although I was able to successfully manage communication with PayPal, I have got stuck and I don't know how to continue at this point. The main problems are:
PayPal requires setting
plan_id
and having Plan created at the time of creating the Subscription.This is not required when using Subscription button (like
django-paypal
does). It brings in whole lot of problems - the price can't be changed per user, it requires implementer to set up the Plans on PayPal and maintain consistency with server settings (especially ifdjango-payments
are used with multiple providers).Getting notification of the payments
I don't know how to capture the recurring payments. With PayPal Subscription buttons PayPal sends notification about the payment. I didn't find how to do that with API. There also might be possibility to check the Subscriptions through the API and check their (possibly changed) expiration.